package cn.buk.tms.entity.misc;

import java.util.Date;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;

@Entity
@Table(name="q_notice")
public class QinfoNotice {

	public final static int OFFICE_NO = 0;
	public final static int MOBILE_NO = 1;
	public final static int USERNAME  = 2;


	@Id
	@GeneratedValue(strategy= GenerationType.IDENTITY)
	private int id;
	
	@Column(name="enterprise_id")
	private int enterpriseId;

	/**
	 * 通知类型
	 * 0 - 根据OFFICENO 通知
	 * 1 - 根据手机号通知
	 * 2 - 根据eterm用户名通知
     */
	@Column(name = "condition_type")
	private int conditionType;

	/**
	 * 通知条件: 比如OFFICENO,或手机号,或ETERM用户名
	 */
	@Column(name = "condition_value")
	private String conditionValue;


	/**
	 * 需要被通知的邮件地址
	 */
	private String email;

	/**
	 * 需要被通知的微信的手机号或短信
	 */
	private String mobile;

	/**
	 * 微信id
	 */
	@Column(name = "weixin_id")
	private String weixinId;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time", insertable = false, updatable = false)
	private Date createTime;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(insertable = false)
	private Date lastupdate;



	/**
	 * @return the id
	 */
	public int getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(int id) {
		this.id = id;
	}

	/**
	 * @return the enterpriseId
	 */
	public int getEnterpriseId() {
		return enterpriseId;
	}

	/**
	 * @param enterpriseId the enterpriseId to set
	 */
	public void setEnterpriseId(int enterpriseId) {
		this.enterpriseId = enterpriseId;
	}

	public int getConditionType() {
		return conditionType;
	}

	public void setConditionType(int conditionType) {
		this.conditionType = conditionType;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public Date getLastupdate() {
		return lastupdate;
	}

	public void setLastupdate(Date lastupdate) {
		this.lastupdate = lastupdate;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getConditionValue() {
		return conditionValue == null ? "" : conditionValue.trim();
	}

	public void setConditionValue(String conditionValue) {
		if (conditionValue != null) {
      conditionValue = conditionValue.trim().toUpperCase();
    }
		this.conditionValue = conditionValue;
	}

	public String getWeixinId() {
		return weixinId;
	}

	public void setWeixinId(String weixinId) {
		this.weixinId = weixinId;
	}
}
